/*     */ package dm.jdbc.driver;
/*     */ 
/*     */ import dm.jdbc.dbaccess.DmMsgSend;
/*     */ import dm.jdbc.desc.ParameterDesc;
/*     */ import dm.sql.TypeDescriptor;
/*     */ import java.sql.SQLException;
/*     */ 
/*     */ 
/*     */ 
/*     */ public abstract class DmBinder
/*     */ {
/*  12 */   int recDType = 0;
/*  13 */   int recPrec = 0;
/*  14 */   int recScale = 0;
/*     */   
/*     */ 
/*  17 */   byte destIoType = 0;
/*  18 */   int destDType = 0;
/*  19 */   int destPrec = 0;
/*  20 */   int destScale = 0;
/*     */   
/*  22 */   int srcScale = 0;
/*     */   
/*     */ 
/*  25 */   byte[] streamReadTry = null;
/*  26 */   int streamReadTryLen = 0;
/*  27 */   boolean streamReadOver = false;
/*  28 */   char[] readerTry = null;
/*  29 */   int readerTryLen = 0;
/*     */   
/*     */ 
/*  32 */   int offset_var = -1;
/*     */   
/*     */ 
/*     */   public static final int RET_LOB_OFF_ROW = -1;
/*     */   
/*     */   public static final int RET_LOB_READ_OVER = 0;
/*     */   
/*  39 */   int sqlType = 0;
/*  40 */   boolean hasSqlType = false;
/*  41 */   boolean hasSqlScale = false;
/*  42 */   int sqlScale = -1;
/*     */   
/*     */   DmdbPreparedStatement_bs pstmt;
/*     */   
/*     */   ParameterDesc[] paramsDesc;
/*     */   
/*  48 */   boolean m_checkType = false;
/*     */   
/*  50 */   private String typeName = null;
/*     */   
/*     */   public DmBinder(DmdbPreparedStatement_bs pstmt) {
/*  53 */     this.pstmt = pstmt;
/*     */     
/*  55 */     init();
/*     */   }
/*     */   
/*     */ 
/*     */   abstract void init();
/*     */   
/*     */   void clearVars()
/*     */   {
/*  63 */     this.streamReadTry = null;
/*  64 */     this.streamReadTryLen = 0;
/*  65 */     this.streamReadOver = false;
/*  66 */     this.readerTry = null;
/*  67 */     this.readerTryLen = 0;
/*     */     
/*     */ 
/*  70 */     this.offset_var = -1;
/*     */   }
/*     */   
/*     */   void checkType(int icol, boolean forBatch) throws SQLException
/*     */   {
/*  75 */     if (this.m_checkType) {
/*  76 */       return;
/*     */     }
/*  78 */     this.m_checkType = true;
/*     */     
/*  80 */     if (this.paramsDesc == null) {
/*  81 */       this.paramsDesc = this.pstmt.getParamsDesc();
/*     */     }
/*  83 */     byte typeFlag = this.paramsDesc[icol].getTypeFlag();
/*  84 */     int dType = this.paramsDesc[icol].getDType();
/*  85 */     int prec = this.paramsDesc[icol].getPrec();
/*  86 */     int scale = this.paramsDesc[icol].getScale();
/*  87 */     byte ioType = this.paramsDesc[icol].getIOType();
/*     */     
/*  89 */     if ((ioType != 1) && 
/*  90 */       (typeFlag != 1)) {
/*  91 */       this.destDType = this.recDType;
/*  92 */       this.destPrec = this.recPrec;
/*  93 */       this.destScale = this.recScale;
/*     */     } else {
/*  95 */       this.destDType = dType;
/*  96 */       this.destPrec = prec;
/*  97 */       this.destScale = scale;
/*     */     }
/*     */     
/* 100 */     this.destIoType = ioType;
/* 101 */     this.srcScale = scale;
/*     */   }
/*     */   
/*     */   public abstract int bindData(DmMsgSend paramDmMsgSend, int paramInt1, int paramInt2, boolean paramBoolean)
/*     */     throws SQLException;
/*     */   
/*     */   public int bindLobCyc(DmMsgSend lobMsg, int irow, int icol) throws SQLException
/*     */   {
/* 109 */     throw new SQLException("Not impletement");
/*     */   }
/*     */   
/*     */   public void setOutNullFlag(boolean flag) throws SQLException {
/* 113 */     throw new SQLException("setOutNullFlag not impletement");
/*     */   }
/*     */   
/*     */   public boolean getOutNullFlag() throws SQLException {
/* 117 */     throw new SQLException("getOutNullFlag not impletement");
/*     */   }
/*     */   
/*     */   public void setOutValue(byte[] out) throws SQLException {
/* 121 */     throw new SQLException("setOutValue not impletement");
/*     */   }
/*     */   
/*     */   public byte[] getOutValue() throws SQLException {
/* 125 */     throw new SQLException("getOutValue not impletement");
/*     */   }
/*     */   
/*     */   public void setSqlType(int sqlType) {
/* 129 */     this.sqlType = sqlType;
/* 130 */     this.hasSqlType = true;
/*     */   }
/*     */   
/*     */   public void setSqlScale(int sqlScale) {
/* 134 */     this.sqlScale = sqlScale;
/* 135 */     this.hasSqlScale = true;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   public int bindDesc(DmMsgSend msg, int icol, boolean forBatch)
/*     */     throws SQLException
/*     */   {
/* 150 */     checkType(icol, forBatch);
/*     */     
/* 152 */     if ((this.destIoType == 2) && 
/* 153 */       (120 != this.destDType)) {
/* 154 */       DmBinder inBinder = ((DmOutParamBinder)this).m_inParamBinder;
/*     */       
/* 156 */       inBinder.checkType(icol, forBatch);
/* 157 */       this.destDType = inBinder.destDType;
/* 158 */       this.destPrec = inBinder.destPrec;
/* 159 */       this.destScale = inBinder.destScale;
/*     */       
/* 161 */       this.destIoType = inBinder.destIoType;
/* 162 */       this.srcScale = inBinder.srcScale;
/*     */     }
/*     */     
/*     */ 
/* 166 */     if ((this.destIoType == 1) && 
/* 167 */       (120 == this.destDType)) {
/* 168 */       msg.appendByte((byte)2);
/*     */     } else {
/* 170 */       msg.appendByte(this.destIoType);
/*     */     }
/*     */     
/* 173 */     msg.setInt(this.destDType);
/*     */     
/*     */ 
/* 176 */     int lprec = 0;
/* 177 */     int lscale = 0;
/* 178 */     boolean isComplex = true;
/* 179 */     TypeDescriptor typeDesc = this.paramsDesc[icol].getTypeDescriptor();
/* 180 */     switch (this.destDType) {
/*     */     case 117: 
/*     */     case 122: 
/* 183 */       lprec = TypeDescriptor.getPackArraySize(typeDesc);
/* 184 */       break;
/*     */     
/*     */     case 121: 
/* 187 */       lprec = TypeDescriptor.getPackRecordSize(typeDesc);
/* 188 */       break;
/*     */     
/*     */     case 119: 
/* 191 */       lprec = TypeDescriptor.getPackClassSize(typeDesc);
/* 192 */       break;
/*     */     case 118: case 120: 
/*     */     default: 
/* 195 */       lprec = this.destPrec;
/* 196 */       lscale = this.destScale;
/* 197 */       isComplex = false;
/*     */     }
/*     */     
/*     */     
/*     */ 
/* 202 */     msg.setInt(lprec);
/*     */     
/*     */ 
/* 205 */     msg.setInt(lscale);
/*     */     
/*     */ 
/* 208 */     switch (this.destDType) {
/*     */     case 117: 
/*     */     case 122: 
/* 211 */       TypeDescriptor.packArray(typeDesc, msg);
/* 212 */       break;
/*     */     
/*     */     case 121: 
/* 215 */       TypeDescriptor.packRecord(typeDesc, msg);
/* 216 */       break;
/*     */     
/*     */     case 119: 
/* 219 */       TypeDescriptor.packClass(typeDesc, msg);
/* 220 */       break;
/*     */     case 118: case 120: 
/*     */     default: 
/* 223 */       isComplex = false;
/*     */     }
/*     */     
/*     */     
/* 227 */     if (isComplex) {
/* 228 */       return 13 + lprec;
/*     */     }
/* 230 */     return 13;
/*     */   }
/*     */   
/*     */   public boolean checkIOType(byte type) {
/* 234 */     if (this.destIoType == type) {
/* 235 */       return true;
/*     */     }
/* 237 */     return false;
/*     */   }
/*     */   
/*     */   public void setInoutParamBinder(DmBinder inBinder) throws SQLException
/*     */   {
/* 242 */     throw new SQLException("setInoutParamBinder not impletement");
/*     */   }
/*     */   
/*     */   public DmdbStatement_bs getCursorStmt() throws SQLException
/*     */   {
/* 247 */     throw new SQLException("getCursorStmt not impletement");
/*     */   }
/*     */   
/*     */   public void clearRetValue() {}
/*     */   
/*     */   public String getTypeName()
/*     */   {
/* 254 */     return this.typeName;
/*     */   }
/*     */   
/*     */   public void setTypeName(String typeName) {
/* 258 */     this.typeName = typeName;
/*     */   }
/*     */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\driver\DmBinder.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */